<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>订单确认</title>
    <link href="css/mui.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="css/aui.css"/>
    <link rel="stylesheet" href="css/shop.css">
    <link rel="stylesheet" href="css/alert.css">
    <script src="js/jquery-1.8.2.min.js"></script>
    <script src="js/mui.min.js"></script>
    <script>

        var autoload=function () {
            var data={};
            data.user_id=user_id;
            data.userpwd=userpwd;
            data.id=getQueryString("id")
            if(user_id==""){
                return;
            }
            $.ajax({
                type: "POST",
                //url: "http://test/jsonp.php",
                data: data,
                url: "http://xjh.taoleyizhan.com/wap/index.php?ctl=shopdetail&act=index",
                dataType: "json",
                success: function (json) {
                    console.log(json)
                    page_data = json
                    $('.goods-name').html(page_data.goods_info.name);
                    $('#o-price').html(page_data.goods_info.origin_price);
                    $('#n-price').html(page_data.goods_info.current_price);
                    //初始化收货地址
                    if(page_data.consignee!=false){
                        $('.consignee .co-name').text(page_data.consignee[0].consignee);
                        $('.consignee .co-mobile').text(page_data.consignee[0].mobile);
                        $('.consignee .co-address').text(page_data.consignee[0].address);
                        $('.consignee').attr('data-id',page_data.consignee[0].address)
                    }else{

                    }
                    if(page_data.user_ticket_info!=false){
                        $('.ticket .co-name').text(page_data.user_ticket_info.name)
                        $('.ticket').attr('data-id',page_data.user_ticket_info.id)
                    }
                    //初始化用户优惠券
                    //InitChat();
                },
                error: function (json) {
                    console.log(json);
                }
            })
        }
    </script>
    <script src="js/init.js"></script>
</head>
<body>
    <header class="mui-bar mui-bar-nav change">
        <a href="javascript:history.go(-1)" class="mui-icon-undo mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title" >订单确认</h1>
    </header>

    <div class="mui-content aui-pad-15 f14 change">
        <div class="aui-pad-t-10 aui-pad-b-10 flex">
            <img class="f1 aui-col-3 aui-mar-r-10" src="image/banner.png" alt="">
            <div class="f3">
                <div class="goods-name"></div>
                <div><span class="f10">商品原价：<b id="o-price"></b>元</span></div>
            </div>
        </div>
        <div class="list_con aui-pad-10 aui-mar-b-15">消费金额 <span class="fr">￥<b id="n-price"></b></span></div>


        <div class="list_con aui-pad-10 aui-mar-b-15 ticket" data-id="">
            <span class="fr"> ></span>
            <span class="co-name">没有可以用的优惠券</span>
        </div>




        <div class="list_con aui-pad-10 aui-mar-b-15 consignee" data-id="">
            <span class="fr"> ></span>
            <span class="co-name">请先配置收货地址</span>
            <span class="co-mobile"></span> <br/>
            <span class="co-address"></span>
        </div>
        <div class="aui-color-gray mui-text-center aui-pad-10 f12">
            <input type="radio">
            <label class="aui-pad-l-5" for="">我已同意并阅读《券游商城服务协议》</label>
        </div>
    </div>
    <div id="buy" class="fix aui-col-10 aui-pad-10 aui-background-yellow mui-text-center f14 change" style="left:0;bottom:0;">确认付款</div>
    <div class="zhifu_tc fix aui-col-10 f12 aui-background-white change" style="bottom:-40%;left:0;">
        <div class="aui-pad-10 aui-border-b-gray mui-text-center f14"><span class="zhifu_back fl"><</span>选择支付方式</div>
        <ul>
            <li data-id="5"><img src="images/zhifu_icon.png" alt="" width="">支付宝 <span class="gou fr"><img src="images/pay_xuan.png" alt="" width="15"></span></li>
            <li data-id="7"><img src="images/weixin_icon.jpg" alt="">微信支付 <span class="gou fr none"><img src="images/pay_xuan.png" alt="" width="15"></span></li>
        </ul>
        <div id="pay-done" class="pay_last aui-background-red aui-pad-10 aui-color-white mui-text-center f14">支付 <span>100</span>元</div>
    </div>
<input id="payment_id" type="hidden" value="5">
    <iframe id="paymentframe" src="" style="width: 100%;height: 900px;outline:none;border: none; display: none"></iframe>
</body>
<script src="js/alert.js"></script>
<script>
    var lock=0
    $('#buy').click(function () {
        $(".zhifu_tc").animate({bottom:0})
    })
    $('#pay-done').click(function () {
        if(lock==0){
            lock=1;
            var user_ticket_id=$(".ticket").attr('data-id')
            var payment_id=$('#payment_id').val();
            var data={}
            data.user_id=user_id;
            data.userpwd=userpwd;
            data.product_id=getQueryString('id');
            data.payment_id=payment_id
            data.user_ticket_id=user_ticket_id
            data.consignee=$('.consignee').attr('data-id')
            if(!data.consignee>1||!data.payment_id>1){
                return;
            }
            if(payment_id==7){

            }else{
                $.ajax({
                    type: "POST",
                    //url: "http://test/jsonp.php",
                    data: data,
                    url: "http://xjh.taoleyizhan.com/wap/index.php?ctl=uc_charge&act=order_done",
                    dataType: "json",
                    success: function (json) {
                        console.log(json)
                        if(json.status ==1 ){
                            //window.location.href=data.jump;
                            $("#paymentframe").attr("src",json.jump);
                            $(".change").hide()
                            $("#paymentframe").show()
                        }else{
                            alert(data.info);
                        }

                        lock=0;
                    },
                    error: function (json) {
                        console.log(json);
                        lock=0;
                    }
                })
            }
            lock=0;
        }
    })
</script>
</html>